Open
Conversation
Adds support for additional keywords in weapons' TipImage.
e.g
```lua
MySkill = Skill:new{
TipImage = {
Sand = Point(1,1),
}
}
```
### New supported keywords:
- Shield
- Sand
- Ice
- Frozen
- Snow
To have multiple features with the same key, the keyword can be suffixed with numbers.
### TipImage Callbacks
This feature allows the optional definiton of a `TipImageCallbacks` table for a weapon, which associates specific elements in the weapon's `TipImage` table to callback functions in `TipImageCallbacks`.
Example:
```lua
TipImageCallbacks = {
ConveyorUp = function(loc)
Board:AddAnimation(loc, "Conveyor_0")
end,
ConveyorDown = function(loc)
Board:AddAnimation(loc, "Conveyor_2")
end,
}
```
This example shows a `TipImageCallbacks` table with two custom callbacks that can be referenced by the weapon's `TipImage`; either by the same name or the name with a numbered suffix.
Example Weapon:
```lua
TipImage = {
Unit = Point(2,2),
Enemy = Point(2,4),
Target = Point(2,4),
ConveyorUp = Point(1,3),
ConveyorUp2 = Point(1,4),
},
TipImageCallbacks = {
ConveyorUp = function(loc)
Board:AddAnimation(loc, "Conveyor_0")
end,
},
```
In this example, the weapon "MySkill" has a `TipImage` table with a `ConveyorUp` at `Point(1,3)`. When the tipimage is displayed in-game, the `TipImageCallbacks.ConveyorUp` function will be called for the `TipImage.ConveyorUp` element, causing an animation "Conveyor_0" to be created at `Point(1,3)` on the game board.
It also has a second `ConveyorUp` entry, suffixed by `2`. The callback TipImageCallbacks.ConveyorUp will be called for this entry as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for additional keywords in weapons' TipImage.
e.g
New supported keywords:
(This PR was made very quickly, so this is not a complete list of keywords that the vanilla game don't support. Feel free to mention other missing keywords)
To have multiple features with the same key, the keyword can be suffixed with numbers.
TipImage Callbacks
This feature allows the optional definiton of a
TipImageCallbackstable for a weapon, which associates specific elements in the weapon'sTipImagetable to callback functions inTipImageCallbacks.Example:
This example shows a
TipImageCallbackstable with two custom callbacks that can be referenced by the weapon'sTipImage; either by the same name or the name with a numbered suffix.Example Weapon:
In this example, the weapon "MySkill" has a
TipImagetable with aStuctureSmallatPoint(2,1). When the tipimage is displayed in-game, theTipImageCallbacks.StuctureSmallfunction will be called for theTipImage.StuctureSmallelement, causing a building with 2/2 health to be created atPoint(1,3)on the game board.It also has a pair of
StructureDamagedentries. When the tipimage is displayed in-game, theTipImageCallbacks.BuildingDamagedfunction will be called for bothTipImage.StructureDamagedandTipImage.StructureDamaged2, causing a building with 1/2 health to be created atPoint(2,2)andPoint(2,3)on the game board.